-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TNO-1136 Set tone by user #2251
Conversation
2967acf
to
bc45f09
Compare
[ProducesResponseType(typeof(ErrorResponseModel), (int)HttpStatusCode.BadRequest)] | ||
[SwaggerOperation(Tags = new[] { "TonePool" })] | ||
[ETagCacheTableFilter("tone_pools")] | ||
[ResponseCache(Duration = 5 * 60)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't make sense on a POST endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
[ProducesResponseType(typeof(TonePoolModel), (int)HttpStatusCode.Created)] | ||
[ProducesResponseType(typeof(ErrorResponseModel), (int)HttpStatusCode.BadRequest)] | ||
[SwaggerOperation(Tags = new[] { "TonePool" })] | ||
[ETagCacheTableFilter("tone_pools")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't make sense on a POST endpoint
[ProducesResponseType(typeof(IEnumerable<TonePoolModel>), (int)HttpStatusCode.OK)] | ||
[ProducesResponseType((int)HttpStatusCode.NotModified)] | ||
[SwaggerOperation(Tags = new[] { "TonePool" })] | ||
[ETagCacheTableFilter("tone_pools")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't make sense on an endpoint that returns one item.
[ProducesResponseType((int)HttpStatusCode.NotModified)] | ||
[SwaggerOperation(Tags = new[] { "TonePool" })] | ||
[ETagCacheTableFilter("tone_pools")] | ||
[ResponseCache(Duration = 5 * 60)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not tested findbyId, just findByUserId. Going to test it.
name: `${userId}`, | ||
ownerId: userId, | ||
}); | ||
const newTonePool = await getMyTonePool(userId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra request isn't needed, just use the returned tonepool from the addMyTonePool
.
/// <summary> | ||
/// get/set - Tone for the content | ||
/// </summary> | ||
public int? Tone {get;set;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you even using this property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is from the previous implementation. Thank you!
{() => ( | ||
<Form> | ||
<FormikSentiment | ||
name="tonePools" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you correctly named this component then the Formik setFieldValue
would work correctly. and you wouldn't need also include the onSentimentChange
logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd need to check this by chat. I'd love to implement this way :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not using FormikSentiment component.
updatedTonePools = [...(tonePools || []), { ...defaultTonePool, value: option }]; | ||
} | ||
|
||
setFieldValue(name.toString(), updatedTonePools, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having both of these can result in odd state. Formik will update the form context and then another separate set of state is being updated next. It is easier to maintain if you make the setFieldValue
work correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not using FormikSentiment.
const api = useApi(options); | ||
|
||
return React.useRef({ | ||
getTonePools: (etag: string | undefined = undefined) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This endpoint doesn't appear to exist.
libs/npm/core/tsconfig.json
Outdated
], | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"paths": { | ||
"@assets/*": ["../../../../app/subscriber/public/assets/*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the need for this? Shouldn't we keep tno-core assets locally? If it's the shared library then the apps that use the shared library should be getting their components/assets from tno-core. It is also easier to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for bringing this, I wanted to use the proper icons instead of applying style:
<FaSmile className="tone-icon" color="#59E9BE" />
The icons are under app/subscriber/public/assets/reports/
, so I created an alias to be used in the import. Then I could use import @reports/[email protected]
a42d911
to
95d7d11
Compare
95d7d11
to
13be7df
Compare
13be7df
to
c7b383f
Compare
c7b383f
to
448d600
Compare
Feature Update: User-Defined Tone Assessment for Articles
This update introduces the ability for subscribers to assess and set a personal tone for an article, independent of the original tone. The custom tone selected by the user will be saved and associated with their account, ensuring that their personal assessment is retained without altering the article's original tone data.
User Tone:
Editor Tone:
In DB, a record is created on
tone_pool
table which is used to tone any content. When the user set a tone for a content, it is saved incontent_tone
table.Story: https://citz-gdx.atlassian.net/browse/TNO-1136